home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1998 July / EnigmA AMIGA RUN 29 (1998)(G.R. Edizioni)(IT)[!][issue 1998-07 & 08].iso / recent / fw_gfx.lha / FW_GfxClip / GfxClip.fwrexx next >
Text File  |  1998-06-14  |  9KB  |  273 lines

  1. /* Optimized with RexxOpt 1.7 */
  2.  
  3. Options results
  4. call addlib('rexxreqtools.library',5,-30)
  5. Address='FinalW'
  6. STATUS PORTNAME
  7. FW=result
  8. address=FW
  9. SIGNAL ON BREAK_C
  10. Call Open("sprache","env:language","R")
  11. language=readln("sprache")
  12. Call Close ("sprache")
  13. If language="deutsch" then;do
  14. t0='"Gfx Clip 4.1 - Makro Generator" "© 1994 Softwood" "& 1998 Heiko Schröder" "Weiter" "Abbrechen" ""'
  15. t1='"Keine Grafik ausgewählt." "Die Vorlage kann nicht erstellt werden." "" "Achso" "" ""'
  16. t2="GFX Clip - Speichern unter"
  17. t21="Speichern"
  18. t3='"Sie haben keinen Dateinamen eingegeben." "Die Vorlage kann nicht erstellt werden." "" "Achso" "" ""'
  19. t4='"Dateifehler!" "" "" "Oje" "" ""'
  20. End
  21. Else;do
  22. t0='"Gfx Clip 4.1 - Macro Generator" "© 1994 Softwood" "& 1998 Heiko Schröder" "Continue" "Cancel" ""'
  23. t1='"No object selected." "The template could not be created." "" "Okay" "" ""'
  24. t2="GFX Clip - Save As"
  25. t21="Save"
  26. t3='"You have not entered a valid filename." "The template could not be created." "" "Okay" "" ""'
  27. t4='"File error!" "" "" "Oops" "" ""'
  28. End
  29. ShowMessage 1 1 t0
  30. IF (Result=2) THEN EXIT
  31. SetMeasure RULER
  32. GetDocItemPrefs Decimal
  33. Punkt=Result
  34. If Punkt="Comma" then DocItemPrefs Decimal Period
  35. Do While 1
  36. i=0
  37. Object.0=0
  38. objtype.0=0
  39. FirstObject SELECTED
  40. IF (Result=0) THEN;DO
  41. ShowMessage 1 1 t1
  42. Call SEnd
  43. END
  44. DO WHILE (Result ~=0)
  45. i=i+1
  46. Object.i=Result
  47. NextObject Object.i SELECTED
  48. END
  49. gruppe=false
  50. Do a=1 to i
  51. GetObjectType Object.a
  52. objtype.a=Result
  53. If objtype.a=8 then;do
  54. SelectObject Object.a
  55. gruppe=true
  56. Ungroup
  57. FirstObject SELECTED
  58. DO WHILE (Result ~=0)
  59. i=i+1
  60. Object.i=Result
  61. NextObject Object.i SELECTED
  62. END
  63. End
  64. End
  65. If gruppe=true then;do
  66. SelectObject Object.1
  67. Do a=2 to i
  68. SelectObject Object.a MULTIPLE
  69. End
  70. End
  71. else leave
  72. End
  73. If GetClip("GFX-DIR")="" Then dir="FWMacros/"
  74. Else dir=GetClip("GFX-DIR")
  75. p=max(index(dir,':'),lastpos('/',dir))
  76. file=delstr(dir,1,p)
  77. dir=substr(dir,1,p)
  78. filename=rtfilerequest(dir,file,t2,t21,"rt_screentofront=true rt_pubscrname=FinalWriterPubScreen")
  79. if filename="" then;DO
  80. ShowMessage 1 1 t3
  81. Call SEnd
  82. END
  83. void=SetClip("GFX-DIR",strip(filename,B,'"'))
  84. IF EXISTS(filename) THEN;DO
  85. IF language="deutsch" then
  86. t5='"Das Template <'||filename||'> existiert bereits." "Möchten Sie es überschreiben?" "" "Ja" "Nein" ""'
  87. Else
  88. t5='"The Template <'||filename||'> already exists." "Would you like to overwrite it?" "" "Yes" "No" ""'
  89. ShowMessage 2 1 t5
  90. IF (Result=2) THEN Call SEnd
  91. END
  92. GetPageSetup HEIGHT
  93. pageHt=Result
  94. IF (OPEN('GfxClipFile',filename,'Write')~=1) THEN;DO
  95. IF language="deutsch" then
  96. t6='"Datei <'||filename||'> kann nicht geöffnet werden." "" "" "Oje" "" ""'
  97. Else
  98. t6='"File <'||filename||'> could not be opened." "" "" "Ok" "" ""'
  99. ShowMessage 1 1 t6
  100. Call SEnd
  101. END
  102. CALL LineOut('GfxClipFile','/* ------------------------ */')
  103. CALL LineOut('GfxClipFile','/* Final Writer Arexx Macro */')
  104. CALL LineOut('GfxClipFile','/* created on' date() '  */')
  105. CALL LineOut('GfxClipFile','/* with GfxClip 4.1         */')
  106. CALL LineOut('GfxClipFile','/* © Softwood / H. Schröder */')
  107. CALL LineOut('GfxClipFile','/* ------------------------ */')
  108. CALL LineOut('GfxClipFile','')
  109. CALL LineOut('GfxClipFile','Options Results')
  110. CALL LineOut('GfxClipFile','SetMeasure RULER')
  111. CALL LineOut('GfxClipFile','GetDocItemPrefs Decimal')
  112. CALL LineOut('GfxClipFile','Punkt=Result')
  113. CALL LineOut('GfxClipFile','If Punkt="Comma" then DocItemPrefs Decimal Period')
  114. CALL LineOut('GfxClipFile','Status PAGE')
  115. CALL LineOut('GfxClipFile','page1=result+1')
  116. CALL LineOut('GfxClipFile','GetSectionSetup FirstPage')
  117. CALL LineOut('GfxClipFile','page2=result')
  118. CALL LineOut('GfxClipFile','page=page1-page2')
  119. CALL LineOut('GfxClipFile','numobjs = 0')
  120. CALL LineOut('GfxClipFile','')
  121. x=0
  122. DO WHILE (x<i)
  123. x=x+1
  124. GetObjectRotation Object.x
  125. objRotate.x=Result
  126. IF (objRotate.x ~=0) THEN
  127. SetObjectRotation Object.x 0
  128. GetObjectCoords Object.x
  129. PARSE VAR Result page.x x1.x y1.x x2.x y2.x
  130. IF (objRotate.x ~=0) THEN
  131. SetObjectRotation Object.x objRotate.x
  132. END
  133. x=0
  134. DO WHILE (x<i)
  135. x=x+1
  136. SELECT
  137. WHEN (objtype.x=2|objtype.x=3) THEN;DO
  138. modifier=""
  139. if (objtype.x=3) THEN
  140. modifier='ARROW'
  141. commandLine='fromX =' x1.x ''
  142. CALL LineOut('GfxClipFile',commandline)
  143. commandLine='toX =' x2.x ''
  144. CALL LineOut('GfxClipFile',commandline)
  145. commandLine='fromY =' y1.x ''
  146. CALL LineOut('GfxClipFile',commandline)
  147. commandLine='toY =' y2.x ''
  148. CALL LineOut('GfxClipFile',commandline)
  149. commandLine='DrawLine page fromX fromY toX toY' modifier
  150. CALL LineOut('GfxClipFile',commandLine)
  151. CALL LineOut('GfxClipFile','objectid.numobjs = Result')
  152. CALL LineOut('GfxClipFile','numobjs = numobjs + 1');
  153. GetObjectParams Object.x TEXTFLOW FLOWDIST LINEWT
  154. PARSE VAR Result tf fd lw
  155. commandLine='SetObjectParams 0 TEXTFLOW' tf 'FLOWDIST' fd 'LINEWT' lw
  156. CALL LineOut('GfxClipFile',commandLine)
  157. GetObjectParams Object.x LINECOLOR
  158. commandLine='SetObjectParams 0 LINECOLOR' "'"||'"'||Result||'"'||"'"
  159. CALL LineOut('GfxClipFile',commandLine)
  160. END
  161. WHEN (objtype.x=4|objtype.x=5) THEN;DO
  162. modifier=""
  163. if (objtype.x=5) THEN
  164. modifier='BEVEL'
  165. commandLine='newX =' x1.x ''
  166. CALL LineOut('GfxClipFile',commandline)
  167. commandLine='newY =' y1.x ''
  168. CALL LineOut('GfxClipFile',commandline)
  169. commandLine='DrawBox page newX newY' x2.x y2.x modifier
  170. CALL LineOut('GfxClipFile',commandLine)
  171. CALL LineOut('GfxClipFile','objectid.numobjs = Result');
  172. CALL LineOut('GfxClipFile','numobjs = numobjs + 1');
  173. GetObjectParams Object.x TEXTFLOW FLOWDIST LINEWT FILL
  174. PARSE VAR Result tf fd lw fl
  175. commandLine='SetObjectParams 0 TEXTFLOW' tf 'FLOWDIST' fd 'LINEWT' lw 'FILL' fl
  176. CALL LineOut('GfxClipFile',commandLine)
  177. GetObjectParams Object.x LINECOLOR
  178. commandLine='SetObjectParams 0 LINECOLOR' "'"||'"'||Result||'"'||"'"
  179. CALL LineOut('GfxClipFile',commandLine)
  180. GetObjectParams Object.x FILLCOLOR
  181. commandLine='SetObjectParams 0 FILLCOLOR' "'"||'"'||Result||'"'||"'"
  182. CALL LineOut('GfxClipFile',commandLine)
  183. END
  184. WHEN (objtype.x=6|objtype.x=9) THEN;DO
  185. modifier=""
  186. if (objtype.x=9) THEN
  187. modifier='ARC'
  188. commandLine='newX =' x1.x ''
  189. CALL LineOut('GfxClipFile',commandline)
  190. commandLine='newY =' y1.x ''
  191. CALL LineOut('GfxClipFile',commandline)
  192. commandLine='DrawOval page newX newY' x2.x y2.x modifier
  193. CALL LineOut('GfxClipFile',commandLine)
  194. CALL LineOut('GfxClipFile','objectid.numobjs = Result');
  195. CALL LineOut('GfxClipFile','numobjs = numobjs + 1');
  196. GetObjectParams Object.x TEXTFLOW FLOWDIST LINEWT FILL
  197. PARSE VAR Result tf fd lw fl
  198. commandLine='SetObjectParams 0 TEXTFLOW' tf 'FLOWDIST' fd 'LINEWT' lw 'FILL' fl
  199. CALL LineOut('GfxClipFile',commandLine)
  200. GetObjectParams Object.x LINECOLOR
  201. commandLine='SetObjectParams 0 LINECOLOR' "'"||'"'||Result||'"'||"'"
  202. CALL LineOut('GfxClipFile',commandLine)
  203. GetObjectParams Object.x FILLCOLOR
  204. commandLine='SetObjectParams 0 FILLCOLOR' "'"||'"'||Result||'"'||"'"
  205. CALL LineOut('GfxClipFile',commandLine)
  206. END
  207. WHEN (objtype.x=7) THEN;DO
  208. commandLine='newX =' x1.x ''
  209. CALL LineOut('GfxClipFile',commandline)
  210. commandLine='newY =' y1.x ''
  211. CALL LineOut('GfxClipFile',commandline)
  212. GetTextBlockText Object.x
  213. text=Result
  214. commandLine='DrawTextBlock page newX newY "'||text||'"'
  215. CALL LineOut('GfxClipFile',commandLine)
  216. CALL LineOut('GfxClipFile','objectid.numobjs = Result');
  217. CALL LineOut('GfxClipFile','numobjs = numobjs + 1');
  218. GetObjectParams Object.x TEXTFLOW FLOWDIST
  219. PARSE VAR Result tf fd
  220. commandLine='SetObjectParams 0 TEXTFLOW' tf 'FLOWDIST' fd
  221. CALL LineOut('GfxClipFile',commandLine)
  222. GetObjectTypeSpecs Object.x SIZE LEADING WIDTH OBLIQUE
  223. PARSE VAR Result sz ld wd ob
  224. commandLine='SetObjectTypeSpecs 0 SIZE' sz 'LEADING' ld 'WIDTH' wd 'OBLIQUE' ob
  225. CALL LineOut('GfxClipFile',commandLine)
  226. GetObjectTypeSpecs Object.x COLOR
  227. commandLine='SetObjectTypeSpecs 0 COLOR' "'"||'"'||Result||'"'||"'"
  228. CALL LineOut('GfxClipFile',commandLine)
  229. GetObjectTypeSpecs Object.x FONT
  230. commandLine='SetObjectTypeSpecs 0 FONT "'||Result||'"'
  231. CALL LineOut('GfxClipFile',commandLine)
  232. END
  233. OTHERWISE ITERATE
  234. END
  235. IF (objRotate.x ~=0) THEN;DO
  236. commandLine='SetObjectRotation 0' objRotate.x
  237. CALL LineOut('GfxClipFile',commandLine)
  238. END
  239. GetObjectTitle object.x
  240. commandLine='SetObjectTitle 0 "'||Result||'"'
  241. CALL LineOut('GfxClipFile',commandLine)
  242. CALL LineOut('GfxClipFile','')
  243. END
  244. CALL LineOut('GfxClipFile','i = 0')
  245. CALL LineOut('GfxClipFile','DO WHILE (i < numobjs)')
  246. CALL LineOut('GfxClipFile','SelectObject objectid.i MULTIPLE')
  247. CALL LineOut('GfxClipFile','i = i + 1')
  248. CALL LineOut('GfxClipFile','END')
  249. CALL LineOut('GfxClipFile','')
  250. CALL LineOut('GfxClipFile','Redraw')
  251. CALL LineOUt('GfxClipFile','GraphicTool')
  252. CALL LineOut('GfxClipFile','')
  253. CALL LineOut('GfxClipFile','If Punkt="Comma" then DocItemPrefs DECIMAL Comma')
  254. CALL CLOSE('GfxClipFile');
  255. x=0
  256. DO WHILE (x<i)
  257. X=X+1
  258. SelectObject Object.x MULTIPLE
  259. END
  260. Call SEnd
  261. LineOut:PROCEDURE
  262. PARSE ARG filehandle,str
  263. len=WRITELN(filehandle,str)
  264. IF (len ~=LENGTH(str)+1) THEN;DO
  265. ShowMessage 1 1 t4
  266. CALL CLOSE(filehandle);
  267. EXIT
  268. END
  269. RETURN
  270. SEnd:
  271. If Punkt="Comma" then DocItemPrefs DECIMAL Comma
  272. Exit
  273. RETURN